package com.lgx.mobile.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.lgx.common.exception.DataException;
import com.lgx.common.web.Pagination;
import com.lgx.mobile.dao.ITopicChatRecordDao;
import com.lgx.mobile.entity.TopicChatRecord;
import com.lgx.mobile.service.ITopicChatRecordService;

/**
 * 话题聊天记录Service
 * 
 * @author xuyichen
 *
 */
@Service("topicChatRecordService")
public class TopicChatRecordService implements ITopicChatRecordService {

	@Autowired
	private ITopicChatRecordDao topicChatRecordDao;

	public ITopicChatRecordDao getTopicChatRecordDao() {
		return topicChatRecordDao;
	}

	public void setTopicChatRecordDao(ITopicChatRecordDao topicChatRecordDao) {
		this.topicChatRecordDao = topicChatRecordDao;
	}

	@Transactional
	public TopicChatRecord createTopicChatRecord(TopicChatRecord topicChatRecord) throws DataException {
		return this.topicChatRecordDao.createTopicChatRecord(topicChatRecord);
	}

	@Transactional
	public TopicChatRecord updateTopicChatRecord(TopicChatRecord topicChatRecord) throws DataException {
		return this.topicChatRecordDao.updateTopicChatRecord(topicChatRecord);
	}

	@Transactional
	public void deleteTopicChatRecord(TopicChatRecord topicChatRecord) throws DataException {
		this.topicChatRecordDao.deleteTopicChatRecord(topicChatRecord);
	}

	@Transactional
	public void deleteTopicChatRecordById(long id) throws DataException {
		this.topicChatRecordDao.deleteTopicChatRecordById(id);
	}

	public TopicChatRecord findTopicChatRecordById(long id) {
		return this.topicChatRecordDao.findTopicChatRecordById(id);
	}
	
	public List<TopicChatRecord> findTopicChatRecordListByTopicId(long topicId){
		return this.topicChatRecordDao.findTopicChatRecordListByTopicId(topicId);
	}
	
	public List<TopicChatRecord> findTopicChatRecordList() {
		return this.topicChatRecordDao.findTopicChatRecordList();
	}

	@Override
	public Pagination findTopicChatRecordPaginationByTopicId(long topicId, Object[] params, int pageSize, int pageNum) {
		return this.topicChatRecordDao.findTopicChatRecordPaginationByTopicId(topicId,params,pageSize,pageNum);
	}
}
